// pages/test/test.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
     isPlay:false,
    markers : [{
      id:0,
      iconPath: "../images/4.jpg",
      latitude: 23.099994,
      longitude: 113.324520,
      width: 50,
      height: 50,
      title:"广州"
    }]
  },
  takePhoto() {
		const ctx = wx.createCameraContext()
		ctx.takePhoto({
			quality: 'high',
			success: (res) => {
        console.log(res)
				this.setData({
					src: res.tempImagePath
				})
			}
		})
	},
	error(e) {
		console.log(e.detail)
	},
  audioPlay:function(){
    this.setData({
      isPlay:!this.data.isPlay
    })
    
    // innerAudioContext.autoplay = true
   
    // this.innerAudioContext.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
    this.innerAudioContext.src="pages/media/bg.mp3"
    if (this.data.isPlay == true){
      this.innerAudioContext.play();
    }
    else{
      this.innerAudioContext.pause();
    }
    
    this.innerAudioContext.onPlay(() => {
      console.log('开始播放')
    })
    this.innerAudioContext.onError((res) => {
      console.log(res.errMsg)
      console.log(res.errCode)
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options)
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    this.innerAudioContext = wx.createInnerAudioContext()
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})